<%@page import="databank.DataBankVo"%>
<%@page import="databank.DataBank"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>view.jsp</title>
<script>
	function getId(id){return document.getElementById(id)}
	function init(){
		getId("btnList").onclick = function(){
			location.href='MyHome.jsp?inc_content=./databank/list.jsp';
		}
		getId("btnModify").onclick = function(){
			frm.action = 'MyHome.jsp?inc_content=./databank/modify.jsp&serial=' + getId("serial").value;
			frm.submit();
		}
	}
	function fileDownload(filename){
		url = './databank/filedownload.jsp?filename='+ filename;
		win = window.open(url,"win","");
	} 
	function funcDel(serial,filename){
	var f = confirm("정말 삭제하시겠습니까 ???");
	if(f){
		location.href='MyHome.jsp?inc_content=./databank/delete_result.jsp&serial='+ serial +"&filename=" + filename;
	}else{
		alert("취소되었습니다.");
	}
}
	function modify(serial){
	location.href='MyHome.jsp?inc_content=./databank/modify.jsp?serial='+serial;
}
</script>
<!-- <script src="../mycode.js"></script> -->
<style>
#view_main{
	width:600px;
	margin:auto;
}
</style>
</head>
<body>
<jsp:useBean id="bankVo" class="databank.DataBankVo" scope="page"/>
<jsp:setProperty property="*" name="bankVo"/>
<%
DataBank bank = new DataBank();
bank.setVo(bankVo);
DataBankVo v = bank.view();
String url = "../upload/" + v.getFilename(); // 파일이 업로드된 실제 경로가 지정됨

%>
<div id='view_main'>
<center>
<form name='frm' action="" method='post' enctype='multipart/form-data'>
<table border=1>
	<tr>
		<td colspan=2 align=center><h3>파일 상세정보</h3></td>
	<tr>
		<td>작성자:</td><td><label name='mid'><%=v.getMid() %></label></td><br>
	</tr>
	<tr>
		<td>작성일:</td><td><label><%=v.getMdate()%></label></td><br>
	</tr>
	<tr>
		<td>제목 :</td><td><label name='subject'><%=v.getSubject() %></label></td><br>
	</tr>
	<tr>
		<td>내용:</td><td><textarea name='content' rows='8' cols='68' name='content' readonly><%=v.getContent() %></textarea></td><br>
	</tr>
	<tr>
		<td>첨부파일:</td><td><label><a href='#' onclick="fileDownload('<%=v.getFilename()%>')"><%=v.getFilename() %></a></label></td><p/>
	</tr>
	<tr>
		<td colspan=2 align=center>
			<input type='button' value='목록' id='btnList'>
			<input type='button' value='수정' id='btnModify'>
			<input type='button' onclick="funcDel('<%=v.getSerial()%>','<%=v.getFilename()%>')" value='삭제' id='btnDelete'>
		</td>
	</tr>
		
</table>

</form>
</center>
<input type='hidden' id='serial' name='serial' value="<%=v.getSerial()%>">



</div>
<script>init();</script>

</body>
</html>